﻿using QDChat.Data;
using QDChat.Domain;
using QDChat.Interface;
using System.Collections.Generic;


namespace QDChat.Service
{
    public sealed class MsgService
    {
        private static object _locker = new object();//锁对象
        private static IChatMessage _message = null;
        private static IChatMessage Instance
        {
            get
            {
                if (_message == null)
                {
                    lock (_locker)
                    {
                        _message = new DbMessage();
                    }
                }
                return _message;
            }
        }

        public static int SendMsg(Message model)
        {
            return Instance.SendMsg(model);
        }

        public static List<Message> GetMsgList(int fromUid, int toUid, int page, int pageSize)
        {
            return Instance.GetMsgList(fromUid, toUid, page, pageSize);
        }
    }
}
